package cn.iocoder.yudao.module.cmt.dal.mysql.base;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.cmt.dal.dataobject.base.BaseMerchantInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.cmt.controller.admin.base.vo.*;

/**
 * 商户信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BaseMerchantInfoMapper extends BaseMapperX<BaseMerchantInfoDO> {

    default PageResult<BaseMerchantInfoDO> selectPage(BaseMerchantInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BaseMerchantInfoDO>()
                .likeIfPresent(BaseMerchantInfoDO::getName, reqVO.getName())
                .likeIfPresent(BaseMerchantInfoDO::getMerchantNo, reqVO.getMerchantNo())
                .eqIfPresent(BaseMerchantInfoDO::getCommunityId, reqVO.getCommunityId())
                .eqIfPresent(BaseMerchantInfoDO::getMerchantType, reqVO.getMerchantType())
                .eqIfPresent(BaseMerchantInfoDO::getAuditStatus, reqVO.getAuditStatus())
                .eqIfPresent(BaseMerchantInfoDO::getMerchantStatus, reqVO.getMerchantStatus())
                .eqIfPresent(BaseMerchantInfoDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(BaseMerchantInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BaseMerchantInfoDO::getId));
    }

}
